FAB ACADEMY 2023

Input devices

Assignments:

Group assignment:

⚡Probe an input device(s)'s analog and digital signals

⚡Document your work on the group work page and reflect on your individual page what you learned.


Individual assignment:

⚡Measure something: add a sensor to a microcontroller board that you have designed and read it.







Inputs and other things



Then I remembered that in my final project I need to "detect plugins that are inserted". What I thought was to ask my instructor what would be the bigger choice, photoresistors, pogopines or Hall effect sensors. In the end I chose the Hall effect sensor (with the help of Abdon's super marmot) because I use the magnets and with that I solve the problem of fixing the chips to the device. I didn't decide in time and the eagle assembly of the plate was complicated. We decided to test all the sensors in one to take advantage of the time and test for my final project.



Made with Clipchamp




 board


//Constants
const int buttonPin = 3;
const int PIN = 4;

//Variables
int buttonState = 0;
int flag=0;

void setup() {
//Input or output?
pinMode(PIN, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
digitalWrite(PIN, LOW);
}

void loop(){
//Read button state
buttonState = digitalRead(buttonPin);

//If button pressed...
if (buttonState == HIGH) { //SI SE PRESIONA PASA VCC
//turn led on & an
if ( flag == 0){
digitalWrite(PIN, HIGH);
flag=1; //change flag variable
}

//button pressed again, turn led off
else if ( flag == 1){
digitalWrite(PIN, LOW);
flag=0; //change flag variable again
}
}
}


SENSOR HALL file


Copyright 2023 - Glenda Dominguez> - Creative Commons Attribution Non Commercial